home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / oolregex / oolregex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-08  |  2.1 KB  |  55 lines

  1. // Oolite Regular Expression Definitions
  2.  
  3. #ifndef _REGEXP
  4. #define _REGEXP 1
  5.  
  6. #define DllExport   __declspec( dllexport )
  7. typedef long HRESULT;
  8.  
  9.  
  10. #define NSUBEXP  50
  11. typedef struct oolregexp {
  12.     char *startp[NSUBEXP];
  13.     char *endp[NSUBEXP];
  14.     char regstart;        /* Internal use only. */
  15.     char reganch;        /* Internal use only. */
  16.     char *regmust;        /* Internal use only. */
  17.     int regmlen;        /* Internal use only. */
  18.     char program[1];    /* Unwarranted chumminess with compiler. */
  19. } oolregexp;
  20.  
  21. //#define E_UNEXPECTED 0x8000FFFF
  22. //#define E_OUTOFMEMORY 0x8007000E
  23. //#define E_INVALIDARG 0x80070057
  24. //#define S_OK 0
  25. #define S_FAIL 1
  26. #define E_REGEXPNOEXP 0x80006001L            // The Regular Expression string was NULL
  27. #define E_REGEXPTOOBIG 0x80006002L            // The Regular Expression was too big
  28. #define E_REGEXPTOOMANYPAREN 0x80006003L    // Too many ()'s 
  29. #define E_REGEXPUNMATCHPAREN 0x80006004L    // Unmatched ()'s
  30. #define E_REGEXPSTARPLUSEMPT 0x80006005L    // *+ operand could be empty
  31. #define E_REGEXPNESTED         0x80006006L    // nested *?+
  32. #define E_REGEXPINVALIDBRKRANGE 0x80006007L    // invalid [] range
  33. #define E_REGEXPUNMATCHBRACKET 0x80006008L    // unmatched []
  34. #define E_REGEXPOPFOLLOWSNOTHING 0x80006009L     // ?+* follows nothing
  35. #define E_REGEXPTRAILINGSLASHS 0x8000600AL    // trailing backslashes
  36.  
  37. // Three different C++ API's
  38.  
  39. // High Level API - calls cached low level API
  40. extern DllExport HRESULT OolRegExpr(const char* string, const char* pattern, ...);
  41. extern DllExport HRESULT OolRegIndx(const char* string, const char* pattern, int subRanges[NSUBEXP][2], int numargs, int noCase);
  42.  
  43. // Low Level API
  44. extern DllExport HRESULT OolRegCompCache(char *exp, oolregexp* &ret);
  45. extern DllExport HRESULT OolRegComp(char *exp, oolregexp* &ret);
  46. extern DllExport HRESULT OolRegExec(oolregexp *prog, char *string, char *start);
  47. extern DllExport HRESULT OolRegSub(oolregexp *prog, char *source, char *dest);
  48. extern DllExport HRESULT OolRegRange(oolregexp* re, int index, char **startPtr, char **endPtr);
  49.  
  50. // internal
  51. extern void OolSetRegError (HRESULT);
  52. extern HRESULT OolGetRegError (void);
  53.  
  54. #endif /* REGEXP */
  55.